package charpter11.lynx;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Random;

public class Eight {
	private int gerbilNumber;
	Eight(){
		gerbilNumber = new Random().nextInt();
	}
	
	public void hop(){
		System.out.println(gerbilNumber + " is hopping.");
	}
	
	public static void main(String[] args){
		List<Eight> gerbils = new ArrayList<Eight>();
		for (int i = 0; i < 100; i ++){
			gerbils.add(new Eight());
		}
		ListIterator<Eight> it = gerbils.listIterator();
		
		while (it.hasNext()) {
			it.next().hop();
		}
	}
}
